package com.nbot.server.job;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.nbot.server.service.KeyParameterLogService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Calendar;

/**
 * 重要参数删除一年前的数据任务
 */
@Component
public class KeyParameterYearJob implements Job {
    private static final Log LOGGER = LogFactory.get();
    @Autowired
    private KeyParameterLogService keyParameterLogService;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        LOGGER.info("执行重要参数删除一年前的数据任务");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.YEAR, -1);
        keyParameterLogService.deleteLt(c.getTimeInMillis() / 1000);
       // System.err.println(c.getTime());


    }

}